package test21;



//不用Scanner过不了
//https://www.nowcoder.com/practice/5a0a2c7e431e4fbbbb1ff32ac6e8dfa0?tpId=182&ru=%2Fexam%2Foj&difficulty=&judgeStatus=&tags=&title=%E6%B4%97%E7%89%8C&sourceUrl=&gioEnter=menu


import java.io.*;

import java.util.*;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: ws
 * Date: 2023-04-25
 * Time: 17:14
 */


public class Main1 {
    static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    static BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));

    public static void main(String[] args) throws IOException{
        Scanner scanner = new Scanner(br);
        int groups = scanner.nextInt();
        while (scanner.hasNextInt()) {
            while (groups-- > 0) {
                int n = scanner.nextInt();
                int k = scanner.nextInt();
                int[] arr = new int[n * 2];
                for (int i = 0; i < arr.length; i++) {
                    arr[i] = scanner.nextInt();
                }
                shuffle(n, k, arr);
            }
            bw.flush();
        }
        br.close();
        bw.close();
    }

    public static void shuffle(int n, int k, int[] arr) throws IOException{
        while (k-- > 0) {
            int[] temp = new int[arr.length];
            for (int i = 0; i < n; i++) {
                temp[2 * i] = arr[i];
                temp[2 * i + 1] = arr[i + n];
            }
            arr = temp;
        }
        for (int j : arr) {
            bw.write(j + " ");
        }
        bw.write("\n");
    }
}
